package com.nhancv.kurentoandroid.bottom_navigation;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.nhancv.kurentoandroid.R;
import com.nhancv.kurentoandroid.loginActivity;
import com.nhancv.kurentoandroid.one2one.One2OneActivity_;

import org.w3c.dom.Text;

/**
 * Created by zhouwei on 17/4/23.
 */

public class HomeFragment extends Fragment {


    public static String tocounter;
    private String mFrom;
    static HomeFragment newInstance(String from){
        HomeFragment fragment = new HomeFragment();
        Bundle bundle = new Bundle();
        bundle.putString("from",from);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(getArguments()!=null){
            mFrom = getArguments().getString("from");
        }
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.home_fragment_layout,null);
        Button button = view.findViewById(R.id.buttoncall);
        EditText editText1 = view.findViewById(R.id.tocounter);
        button.setOnClickListener(v -> {
            if(!TextUtils.isEmpty(editText1.getText().toString())){
                tocounter = editText1.getText().toString();
            }
            One2OneActivity_.intent(getActivity()).start();});
        return view;
    }
}
